<?php


namespace App\controllers\v1;


use App\controllers\Base;
use Helper\Config;
use Helper\Output;
use Helper\MagicCrypt;
use Helper\Mysql;
use Firebase\JWT\JWT;
use Helper\Reg;

class MessageBoard extends Base
{

    public function create($request, $response){


        try {

            $platform_id = MagicCrypt::getInstance()->decrypt($request->post['platform_id']);
            if(empty($platform_id)){
                return  Output::json(500,'参数p错误');
            }
            $request->post['platform_id'] = $platform_id;
            $request->post['uid'] = Reg::getInstance()->get('customer_id');
            $request->post['create_at'] =time();
            $request->post['is_read'] = 0;

            $res = Mysql::getInstance()->insert('message_board',$request->post);
            if($res){
                return Output::json(200);
            }else{

                return Output::json(400);
            }


        }catch (\Exception $e){

            return  Output::json(500,'参数p错误');
        }

    }

}